package two_shape;

import javafx.application.Application;
import javafx.scene.Group;
import javafx.scene.Scene;
import javafx.scene.shape.Polygon;
import javafx.stage.Stage;

/**
 * 多边形
 */
public class PolygonsExample extends Application {
    @Override
    public void start(Stage primaryStage) throws Exception {
        Group root = new Group();
        primaryStage.setTitle("Pollygon Example");

        Polygon polygon = new Polygon();
        //传入各点的横纵坐标
        polygon.getPoints().addAll(new Double[]{
                0.0, 0.0,
                100.0, 200.0,
                200.0, 100.0 });

        root.getChildren().add(polygon);
        Scene scene = new Scene(root,300,400);
        primaryStage.setScene(scene);
        primaryStage.show();
    }

    public static void main(String[] args) {
        launch(args);
    }
}
